<?php

class subject extends IgnitedRecord
{
	var $has_and_belongs_to_many = 'teachers';
	var $has_many = array('attendances', 'descriptions');
	
	function subject()
	{
        parent::IgnitedRecord();
    }
    
    function get()
    {
    	$query = $this->db->query(	"SELECT * FROM subjects ");
        $heading = array('ID', 'Nazwa przedmiotu');
        $count = $this->db->count_all('subjects');
    	
    	return array('query'=> $query, 'heading' => $heading, 'count' => $count);    	
    }
    
    function update($_POST, $id)
    {
        $this->db->where('id', $id);
        $val['name'] = $_POST['name'];
        $this->db->update('subjects', $val);

    }
    
    function get_related($id)
    {
        return array();
    }
}
?>
